using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Installer
{
    public partial class Sources : Form
    {
        string _FileName = Application.ExecutablePath + ".set";
        private DataTable mSources;// = new DataTable("Sources");
        public Sources()
        {
            InitializeComponent();
            SetDataset();
        }
        public Sources(string sFilename)
        {
            InitializeComponent();
            _FileName = sFilename;
            SetDataset();
        }
        private void SetDataset()
        {
            if (_FileName.Length == 0 || !System.IO.File.Exists(_FileName))
            {
                mSources = new DataTable("Sources");
                mSources.Columns.Add("Name");
                mSources.Columns.Add("URL");
            }
            else
            {
                mSources = new DataTable();
                mSources.ReadXml(_FileName);
            }
            grdSources.DataSource = mSources;
        }

        private void Sources_FormClosing(object sender, FormClosingEventArgs e)
        {
            mSources.WriteXml(_FileName, XmlWriteMode.WriteSchema);
        }
    }
}